/***************************************************************************
 ***************************************************************************
 *  @file x.h
 *  功能:测试
 *
 *                                                                         *
 ***************************************************************************/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTimer>
#include "vreptest.h"
#include "testform.h"
#include <string>
#include "GeneralDefine.h"

class MessageLog;

using namespace std;
namespace Ui {
class MainWindow;
}
class QStandardItemModel;
class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

public:
    int showMotionForm();
    int setDebugFlag(int debugFlagIn);
    int setMainVersion(string versionIn,string dateIn);
private slots:
    void on_pushButton_quick_stop_clicked();

    void on_spinBox_time_valueChanged(int arg1);

    void on_checkBox_on_off_toggled(bool checked);

    void on_pushButton_clear_clicked();

    void on_checkBox_toggled(bool checked);

    void on_pushButton_3_clicked();

    void on_pushButton_4_clicked();

    void on_pushButton_5_clicked();

    void on_pushButton_read_sdo_clicked();

    void on_pushButton_write_sdo_clicked();

    void on_pushButton_clearBatteryError_clicked();

    void on_pushButton_setCurrentRobotDcMode_clicked();

    void on_pushButton_writeAlias_clicked();

    void on_pushButton_getSlavesInfo_clicked();

    void on_pushButton_read_sdo_2_clicked();

    void on_pushButton_setTorqueFilter_clicked();

    void on_checkBox_positionIncrementValid_clicked(bool checked);



public slots:
    void timeOut_slot();
    void setDoValue(bool checked);

private:
    void updateIoStatus();
    void initialIoDisplay();
    void showDebugInfo();
    void showDebugInfo_ethercat(EthercatDebugInfo info);
    void showMessageInfo();
    void showMotorStatusInfo();

public:
    testForm* ecatForm;
//    MotionForm *motionForm;
    VrepTest *vrepForm;

private:
    Ui::MainWindow *ui;
    int choose_axis;
    int robotId;
    int messageSize;
    bool servoOnState;
    QTimer *timer;
    UserInfo userInfo;//ENUM_POWER_ADMIN
    QStandardItemModel* model_ethercatSlavesInfo;
    QStandardItemModel* model_axisgroupCalibrateInfo;
    QStandardItemModel* model_ecatDebugInfo;
    QStandardItemModel* model_canDebugInfo;
    QStandardItemModel* model_modbusDebugInfo;

    int debugFlag;
    /**
     * @brief messageLog        消息日志组件
     */
    MessageLog *messageLog;

    QCheckBox* di_box[64];
    QCheckBox* do_box[64];
    QLineEdit* ai_box[64];
    QLineEdit* ao_box[64];

};

#endif // MAINWINDOW_H
